package com.qf.rbac2202.sys.controller;


import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.qf.rbac2202.sys.entity.SysUser;
import com.qf.rbac2202.sys.service.ISysUserRoleService;
import com.qf.rbac2202.sys.service.ISysUserService;
import com.qf.rbac2202.utils.PageVo;
import com.qf.rbac2202.utils.R;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

/**
 * <p>
 * 系统用户 前端控制器
 * </p>
 *
 * @author dongjl
 * @since 2022-04-16
 */
@RestController
@RequestMapping("/sys/user")
public class SysUserController extends AbstractController {

	@Autowired
	ISysUserService sysUserService;

	@Autowired
	ISysUserRoleService sysUserRoleService;

	/**
	 * 获取登录的用户信息
	 */
	@RequestMapping("/info")
	public R info( ) {
		return R.ok( ).put( "user",getUser( ) );
	}

	@GetMapping("/list")
	@RequiresPermissions( "sys:user:list" )
	public R list(@RequestParam Map< String, Object > params ) {
		PageVo pageVo=sysUserService.getList(params);
        return  R.ok().put("page",pageVo);

	}


}
